package com.vitabuybuy.tv.ui.shopcenter.adapter

import android.view.View
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.vitabuybuy.tv.R
import com.vitabuybuy.tv.adaptebinding.ImageAdapter
import com.vitabuybuy.tv.databinding.ItemCommentImageBinding
import com.vitabuybuy.tv.dto.OrderDetailDto
import com.library.common.base.BindRecycAdapter

class CommentImageListAdapter : BindRecycAdapter<ItemCommentImageBinding,OrderDetailDto.ItemListBean.VideoAndPicBean>(){
    override fun onBindViewHolder(
        mBinding: ItemCommentImageBinding,
        itemData: OrderDetailDto.ItemListBean.VideoAndPicBean,
        holder: RecyclerView.ViewHolder,
        position: Int
    ) {
        if(itemData.tag == "video"){
            mBinding.ivPlay.visibility = View.VISIBLE
            ImageAdapter.setNomalImageUrl(mBinding.iv,itemData.cover,
                ContextCompat.getDrawable(mContext,R.drawable.default_image))
        }else{
            mBinding.ivPlay.visibility = View.GONE
            ImageAdapter.setNomalImageUrl(mBinding.iv,itemData.fileUrl,ContextCompat.getDrawable(mContext,R.drawable.default_image))
        }
    }

    override fun normalViewId(viewType: Int): Int {
        return R.layout.item_comment_image
    }

}
